#ifndef LIBVZCONN_VZ_CLIENT_H_
#define LIBVZCONN_VZ_CLIENT_H_

#include "vzconn/conn/tcpconnect.h"
#include "vzconn/conn/vzconnect.h"

namespace vzconn {

typedef boost::function < void(
  VzConnect::Ptr connect,
  const boost::system::error_code& err) > CallBackConnect;

////////////////////////////////////////////////////////////////////////////////

class VzClient : public boost::noncopyable,
  public boost::enable_shared_from_this < VzClient > {
 public:

  static VzConnect::Ptr ConnectTcpServer(
    boost::asio::io_service& io_service,
    const std::string addr,
    uint16 port,
    CallBackConnect call_back);

  static VzConnect::Ptr ConnectIpcServer(
    boost::asio::io_service& io_service,
    const std::string addr,
    uint16 port,
    CallBackConnect call_back);

  static BlockVzConnect::Ptr ConnectBlockTcpServer(
    boost::asio::io_service& io_service,
    const std::string addr,
    uint16 port);

  static BlockVzConnect::Ptr ConnectBlockIpcServer(
    boost::asio::io_service& io_service,
    const std::string addr,
    uint16 port);

 private:
  static void HandleStaticServerConnect(
    VzConnect::Ptr connect,
    const boost::system::error_code& err,
    CallBackConnect call_back);
};

}

#endif // LIBVZCONN_VZ_CLIENT_H_